package models

type Game struct {
	ID
	Name        string       `json:"name" gorm:"not null;comment:游戏名称"`
	Icon        string       `json:"icon" gorm:"comment:游戏图标"`
	GameUrl     string       `json:"game_url" gorm:"comment:游戏地址"`
	Desc        string       `json:"desc" gorm:"type:text;comment:游戏描述"`
	Image       string       `json:"image" gorm:"comment:游戏图片"`
	Introduce   string       `json:"introduce" gorm:"comment:游戏介绍"`
	Width       int          `json:"width" gorm:"comment:宽度"`
	Height      int          `json:"height" gorm:"comment:高度"`
	Status      int          `json:"status" gorm:"comment:状态"`
	Category    Category     `json:"category" gorm:"foreignKey:CategoryId"`
	CategoryId  uint         `json:"category_id" gorm:"comment:分类ID"`
	IsNew       int          `json:"is_new" gorm:"comment:是否是新游戏"`          //是否是新游戏
	IsRecommend int          `json:"is_recommend" gorm:"comment:是否是推荐游戏"`   //是否是推荐游戏
	IsHot       int          `json:"is_hot" gorm:"comment:是否是热门游戏"`         //是否是热门游戏
	Sort        int          `json:"sort" gorm:"comment:游戏排序"`              //游戏排序
	Tags        []Tag        `json:"tags" gorm:"many2many:game_tags"`       //        //tag
	Click       int          `json:"click" gorm:"comment:点击量"`              //点击量
	ScreenShots []ScreenShot `json:"screen_shots" gorm:"foreignKey:GameId"` //屏幕截图
	GameVideos  []GameVideo  `json:"game_videos" gorm:"foreignKey:GameId"`  //游戏视频
	Timestamps
	SoftDeletes
}

type Tag struct {
	ID
	Name  string `json:"name" gorm:"not null;unique;comment:标签名称"`
	Games []Game `json:"games" gorm:"many2many:game_tags"` // 添加反向关联
	Img   string `json:"img" gorm:"comment:标签图片"`
	Timestamps
	SoftDeletes
}
type TageListResponse struct {
	ID
	Name string `json:"name" `
	Img  string `json:"img" `
	Timestamps
	SoftDeletes
	GameCount int64 `json:"game_count"`
}

type TagRequest struct {
	Name string `json:"name" gorm:"not null;unique;comment:标签名称"`
}

// 添加中间表结构
type GameTag struct {
	ID
	GameId uint `json:"game_id" gorm:"not null;index:idx_game_tag"`
	TagId  uint `json:"tag_id" gorm:"not null;index:idx_game_tag"`
}
type ScreenShot struct {
	ID
	Image  string `json:"image" gorm:"not null;comment:屏幕截图"`
	GameId uint   `json:"game_id" gorm:"not null;comment:游戏ID"`
	Timestamps
	SoftDeletes
}
type ScreenShotRequest struct {
	Image  string `json:"image" gorm:"not null;comment:屏幕截图"`
	GameId uint   `json:"game_id" gorm:"not null;comment:游戏ID"`
}

type GameVideo struct {
	ID
	Video  string `json:"video" gorm:"not null;comment:游戏视频"`
	GameId uint   `json:"game_id" gorm:"not null;comment:游戏ID"`
	Timestamps
	SoftDeletes
}

type GameVideoRequest struct {
	Video  string `json:"video" gorm:"not null;comment:游戏视频"`
	GameId uint   `json:"game_id" gorm:"not null;comment:游戏ID"`
}
